# Makefile for sample java files
#
# If not installed in ORACLE_HOME, set ORACLE_HOME to installation root
#
# ======================================================================

.SUFFIXES : .java .class

CLASSES = DOMSample.class DOMNamespace.class DOM2Namespace.class DOMRangeSample.class EventSample.class NodeIteratorSample.class TreeWalkerSample.class AutoDetectEncoding.class I18nSafeXMLFileWritingSample.class ParseXMLFromString.class

# Change it to the appropriate separator based on the OS.
PATHSEP = :

XMLFILES = class empl family NSExample
COMMON_PATH = ../common/
XML = .xml

# Assumes that the CLASSPATH contains JDK classes.
MAKE_CLASSPATH = .$(PATHSEP)../common$(PATHSEP)$(ORACLE_HOME)/lib/xmlparserv2.jar$(PATHSEP)$(CLASSPATH)

.java.class:
	javac -classpath "$(MAKE_CLASSPATH)" $<


# make all class files
all: $(CLASSES) 

demo: 	$(CLASSES) \
	DOMSample DOMNamespace DOM2Namespace DOMRangeSample \
	EventSample NodeIteratorSample TreeWalkerSample \
	ParseXMLFromString I18nSafeXMLFileWritingSample AutoDetectEncoding

DOMSample DOMNamespace DOM2Namespace DOMRangeSample:
	for file in $(XMLFILES) ; \
	do \
	java -classpath "$(MAKE_CLASSPATH)" $@ $(COMMON_PATH)$$file$(XML) > $@_$$file.out; \
	done

EventSample NodeIteratorSample TreeWalkerSample ParseXMLFromString:
	java -classpath "$(MAKE_CLASSPATH)" $@ > $@.out

I18nSafeXMLFileWritingSample:
	java -classpath "$(MAKE_CLASSPATH)" $@ $@.out

AutoDetectEncoding:
	java -classpath "$(MAKE_CLASSPATH)" $@ ../common/empl.xml > $@.out

clean:
	rm -f *.class
	rm -f *.out
